package com.dcm.item.controller;

import com.dcm.common.annotation.EnableResponseBodyAdvice;

import com.dcm.item.dto.UserBillDto;
import com.dcm.item.entity.UserBillEntity;
import com.dcm.item.service.UserBillService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author: liutaoran
 * @date: 2021-03-30 19:03
 */
@Api(tags = "UserBillController")
@RestController
@RequestMapping("/userbill")
@EnableResponseBodyAdvice
public class UserBillController {



    @Autowired
    private UserBillService userBillService;

    /**
     * 查询
     *
     * @return
     */
    @GetMapping("/findAll")
    public List<UserBillEntity> findAll() {
        return userBillService.findAll();
    }

    /**
     * 查询
     * 消费记录：按照时间筛选查看明细
     * @return
     */
    @PostMapping("/findTime")
    public List<UserBillEntity> findTime(@RequestParam String startTime,
                                         @RequestParam String endTime) {
        return userBillService.findTime(startTime,endTime);
    }



    /**
     * 查询
     *消费记录：消费明细列表，展示支出及收入总额，按时间倒序排列
     * @return
     */
    @GetMapping("/findNotes")
    public List<UserBillDto> findNotes() {
        return userBillService.findNotes();
    }


    /**
     * 查询
     *累计充值：展示累计充值总额
     * @return
     */
    @GetMapping("/findGetSumNumber")
    public int findGetSumNumber() {
        return userBillService.findGetSumNumber();
    }


    /**
     * 查询
     *累计消费：展示累计消费总额
     * @return
     */
    @GetMapping("/findSetSumNumber")
    public int findSetSumNumber() {
        return userBillService.findSetSumNumber();
    }
}
